//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;
using CommunityServer.Components;

namespace CommunityServer.Discussions.Components
{
	/// <summary>
	/// Summary description for BaseForumsRssWriter.
	/// </summary>
	public abstract class BaseForumsRssWriter : CommunityServer.Components.BaseRssWriter
	{
		public BaseForumsRssWriter(ArrayList posts, Section s, string baseUrl) : base(posts,s, baseUrl)
		{
			
		}

	    protected override string BuildLink(Post p)
	    {
	       return Globals.GetSiteUrls().Post(p.PostID);
	    }

        protected override string EnclosureUrl(PostAttachmentMetaData pa)
        {
            return pa.FileName;
        }

		protected override string GetUserName(Post p)
		{
			User u = p.User;
			if (u == null)
				u = Users.GetUser(p.UserID, p.Username, false, true);

			if (u != null)
				return u.DisplayName;
			else
				return p.Username;
		}

	}
}
